#ifndef SPI_H
#define SPI_H

#include <inttypes.h>
#include <avr/io.h>

#define SPI_PORT	PORTB
#define SPI_PIN		PINB
#define SPI_DDR		DDRB

#define SPI_SCK		PB7
#define SPI_MISO	PB6 
#define SPI_MOSI	PB5  
#define SPI_SS		PB4

#define SPI_SS_HIGH() (SPI_PORT |= (1<<SPI_SS))
#define SPI_SS_LOW() (SPI_PORT &= ~(1<<SPI_SS))

#define SPI_DONT_CARE (0x00)

#define SPI_CAN (0x00) //TODO
#define SPI_LCD (0x01) //TODO

void spi_init(void);
uint8_t spi_readwrite(uint8_t data);
uint8_t spi_read(void);
void spi_write(uint8_t data);
void spi_select_can(void);
void spi_select_lcd(void);


#endif
